﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyWeb.Data;
using MyWeb.Common;
using MyWeb.Business;


public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void bttLogin_Click(object sender, EventArgs e)
    {
        //check roles is administrator, login
        int status = tblUSER_PROFILEService.tblUSER_PROFILE_CheckLogin(txtUsername.Text,
                                                                         StringClass.Encrypt(txtPassword.Text));
        if ( status > 0 )
        {
            Session["Status"] = status;
            Session["Username"] = txtUsername.Text;
            Response.Redirect("~/Default.aspx");
        }
        else
        {
            WebMsgBox.Show("Login Error!");
        }
    }
}